{include admin.inc.header}

{include admin.inc.top}

<div class="container-fluid content-body">
	<div class="main">
		{include admin.inc.menu}

		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				{include admin.inc.bread}

				<!-- Nav tabs -->
				<ul class="nav nav-tabs">
					{loop $__sysmenus[$menu_key][subs] $k $v}
					<li{if $v[id]==$menu_id} class="active"{/if}><a href="{if $v[id]==$menu_id}javascript:;{else}/{$v[url]}{/if}"><i class="glyphicon glyphicon-th-list"></i> {$v[name]}</a></li>
					{/loop}
				</ul>

				<div class="inner-container">
					<!-- search form start -->
					<form class="form-inline form-search" role="form" id="search-form" autocomplete="off">
						<nav class="inline-form clearfix">
							<a class="btnlg mb fl" href="javascript:;" id="content-add"><i class="css-add"></i>添加会员</a>
							<div class="r">
								<div class="form-group">
									<!--<div class="input-group">
                                        <div class="input-group-btn">
                                            <select class="form-control input-sm search-options" name="select_name">
                                                <option value="mobile" {if $params[select_name]=='mobile'}selected{/if}>手机号码</option>
                                                <option value="contacter" {if $params[select_name]=='contacter'}selected{/if}>联系人</option>
                                                <option value="level2_domain" {if $params[select_name]=='level2_domain'}selected{/if}>二级域名</option>
                                                <option  value="domain" {if $params[select_name]=='domain'}selected{/if}>一级域名</option>
                                            </select>
                                        </div>&lt;!&ndash; /btn-group &ndash;&gt;
                                        <input  type="text" name="mobile" value="{$params[$params['select_name']]}" class="form-control input-sm">

                                    </div>-->
									<div class="input-group">
										<div class="input-group-addon">手机号码</div>
										<input  type="text" name="username" value="{$params['username']}" class="form-control input-sm">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">来源</div>
										<select class="form-control input-sm" name="from">
											<option value="-1">全部</option>
											{loop $cstatus $key $val}
											<option value="{$key}" {if $params[from]==$key}selected{/if}>{$val}</option>
											{/loop}
										</select>
									</div>
								</div>

								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">注册时间</div>
										<div class="clearfix">
											<input type="text" name="starttime" value="{$params[starttime]}" class="form-control input-sm mdate" placeholder="开始日期">
											<input type="text" name="endtime" value="{$params[endtime]}" class="form-control input-sm mdate" placeholder="结束日期">
										</div>
									</div>
								</div>

								<button type="submit" class="btn btn-success btn-sm">
									<i class="glyphicon glyphicon-search"></i> 搜索</button>
								{data_export_btn}
							</div>
						</nav>

					</form>

					<form id="J_List_Form">
						<div class="table-responsive">
							<table class="table table-bordered table-hover" id="J_List_Table">
								<thead>
								<tr>
									<th width="20"><input type="checkbox" class="icheck check-all" /></th>
									<th>会员号</th>
									<th>手机号码</th>
									<th>来源</th>
									<th>会员状态</th>
									<th>注册时间</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td class="no-records text-center">{$noRecords}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td><input type="checkbox" class="icheck" name="ids[]" id="checkbox_row_{$value[id]}" /></td>
									<td><label for="checkbox_row_{$value[id]}">{$value[id]}</label></td>
									<td>{$value[username]}</td>
									<td>{$cstatus[$value[from]]}</td>
									<td>
										<div class="bootstrap-switch-swrap">
											<input type="checkbox" data-id="{$value[id]}" data-field="status" class="bswitch bswitch-list" data-size="mini"
												   {if $value[status]==1}checked{/if} data-on-text="启用" data-off-text="禁用">
										</div>
									</td>
									<td>{$value[addtime]}</td>
									<td>
										{if $loginUser->hasPermission('admin/user/update')}
										<a href="#" data-id="{$value[id]}" class="btn btn-primary btn-xs item-edit">
											<i class="glyphicon glyphicon-edit"></i> 修改</a>
										{/if}
										{if $loginUser->hasPermission('admin/user/delete')}
										<a href="{$delete_url}/?id={$value[id]}" class="btn btn-danger btn-xs item-remove">
											<i class="glyphicon glyphicon-trash"></i> 删除</a>
										{/if}
									</td>
								</tr>
								{/loop}
								</tbody>
							</table>
						</div>
					</form>

					<div class="text-right">
						{$pagemenu}
					</div>

				</div>

			</div><!-- end of inner -->
		</section>

	</div>
</div>

{include admin.inc.footer}

<script type="text/html" id="content-add-template">

	<form role="form" class="content-add-form" id="content-add-form" autocomplete="off">

		<input type="password" style="position: absolute;left:-9999px;opacity: 0;">

		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span> 手机号码</label>
				<input type="text" dtype="mobile" name="data[username]" value="{[item.username]}" class="form-control" maxlength="11" placeholder="手机号码" required />
			</div>
			<p class="help-block"></p>
		</div>

		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span> 登录密码</label>
				<input id="password" type="password" name="data[password]" dtype="pwd" value="" class="form-control" maxlength="30" {[if item.password == null]} placeholder="登录密码" required {[else]} placeholder="不填写表示不更改" {[/if]}/>
			</div>
			<p class="help-block"></p>
		</div>

		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span> 确认密码</label>
				<input type="password" name="data[repass]" for-password="password" dtype="repass" value="" class="form-control" maxlength="30" placeholder="确认密码"{[if item.password == null]} required {[/if]}/>
			</div>
			<p class="help-block"></p>
		</div>

		<div class="form-element">
			<div class="form-group">
				<label>会员状态</label>
				<div class="bootstrap-switch-swrap">
					<input type="checkbox" class="bswitch bswitch-list" data-size="mini"  {[if item.status == 1 ]}checked{[/if]} data-on-text="启用" data-off-text="禁用">
					<input type="hidden" name="data[status]" value="{[item.status]}">
				</div>
			</div>
			<p class="help-block"></p>
		</div>

		<input type="hidden" name="id" value="{[item.id]}">
	</form>
</script>

<script>
	seajs.use("user", function(exports) {
		exports.init({
			set_url : '/admin/user/set/',
			insert_url : '{$insert_url}',
			edit_url : '{$edit_url}',
			update_url : '{$update_url}',
		});
	});
</script>
</body>
</html>
